# 可变参数   元组类型

def calc(*args):
    print(type(args))
    for a in args:
        print(a)


calc(1, 2, 'a')


# 关键字可变参数    字典类型
def getKey(**kwargs):
    print(kwargs)
    print(type(kwargs))


dictA = {'name': 'tqq'}
print(type(dictA))
getKey(**dictA)
getKey(name='tqq')


def allIn(*args, **kwargs):
    print(args)
    print(kwargs)


allIn('1', dictA)
allIn('1', name='tqq')


# 获取字典中value长度大于二的保留前两个内容并返回
def get2Val(kv):
    for key, value in kv.items():
        if len(value)>2:
            value = value[0:2]
            kv[key]= value
            print(value)
            pass
    return kv

val2 = {'name':'tqq','othername':'wtf'}
kv = get2Val(val2)
print(kv)